#!/usr/bin/python3

from pylab import *
import sys
import re


def main():
    lines = sys.stdin.readlines()
    time = 0
    X = []
    Y = []
    Z = []
    for line in lines:
        if re.match(r'removing edge \S+ -> \S+ \(\d+\)', line):
            matches = re.findall(r'^removing edge .* \((\d+)\)$', line)
            X.append(matches[0])
        if re.match(r'\d+ connected components', line):
            matches = re.findall(r'^(\d+) connected components$', line)
            Y.append(matches[0])
        if re.match(r'gn: \d+ iteration, \d+\.\d+ seconds', line):
            matches = re.findall(r'(\d+\.\d+) seconds$', line)
            Z.append(float(matches[0]))
        if re.match(r'\d+ edges', line):
            time += 1
    Z_ = [Z[0]]
    i = 1
    while i < len(Z):
        Z_.append(Z[i] - Z[i - 1])
        i += 1
    plot([x for x in range(len(X))], X)
    plot([x for x in range(len(Y))], Y)
    plot([x for x in range(len(Z_))], Z_)
    yscale('log')
    grid()
    show()

if __name__ == "__main__":
    main()
